/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package validação;

/**
 *
 * @author Admin
 */
public class ValidaTelefone {

   public static void validarTelefone(String TEL) {
            
        /**
         * mascara do Telefone: (99)9999-9999
         */
        System.out.print("(" + TEL.substring(0, 2) + ")" + TEL.substring(2, 6) + "-" + TEL.substring(6, 10)); 
    }
}

//Outra forma de Mascara para CEP TELEFONE e Demais.
//public static String formatString(String value, String pattern) {  
//    MaskFormatter mf;  
//    try {  
//        mf = new MaskFormatter(pattern);  
//        mf.setValueContainsLiteralCharacters(false);  
//        return mf.valueToString(value);  
//    } catch (ParseException ex) {  
//        return value;  
//    }  
//}  
//
//String CEP = formatString("12345678","#####-###");  
//  
//String TEL = formatString("1234567890123","(##) ####-####");  